﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;

namespace DARE
{
    public class CInventoryData : CWidgetData
    {
        public List<long> allowedTypes;
        public float interval;
        public Vector2 itemsSize;
        public int nbByLine;
        public int nbItems;
        public List<string> lines;


        public override void FillDataStructure(CWidget wid)
        {
            CInventory w = wid as CInventory;
            base.FillDataStructure(wid);
            allowedTypes = new List<long>();
            foreach (long nb in w.AllowedTypes)
                allowedTypes.Add(nb);
            interval = w.Interval;
            nbItems = w.NbItems;
            itemsSize = w.ItemsSize;
            nbByLine = w.NbByLine;
            lines = new List<string>();
            foreach (CContainerLine cl in w.GetLines())
                lines.Add(cl.Name);
        }

        public override void FillFromDataStructure(ref CWidget wid, CHUDSystem hud)
        {
            base.FillFromDataStructure(ref wid, hud);
            foreach (long l in allowedTypes)
                (wid as CInventory).AllowedTypes.Add(l);
            (wid as CInventory).Interval = interval;
            (wid as CInventory).ItemsSize = itemsSize;
            (wid as CInventory).NbByLine = nbByLine;
            (wid as CInventory).NbItems = nbItems;
            //peut etre probleme avec les items stockés dans l'inventory.
        }
    }
}
